package com.lagou;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class SortMapper extends Mapper<LongWritable, Text,SortBean,NullWritable> {
    //创建bean对象
    SortBean bean = new SortBean();
    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        //获取输入文本中的值
        String s = value.toString();
        int i = Integer.parseInt(s);
        bean.setNum(i);
        //随便给个值，防止空指针异常
        bean.setId(1);
        context.write(bean, NullWritable.get());



    }
}
